﻿namespace WLFramework.Validation
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    public enum ValidatePriority
    {
        High = 1,
        Medinum = 2,
        Low = 9999,
    }

    public abstract class ValidationAttribute : Attribute
    {
        public string ErrorMessage { get; protected set; }
        
        public string DefaultMessage { get; protected set; }

        public virtual ValidatePriority Priority { get { return ValidatePriority.Low; } }

        public abstract ValidateResult IsValid(object input, ValidateContext context);

        public virtual string FormatErrorMessage(string name)
        {
            return string.Format(ErrorMessage, name);
        }

        public virtual string FormatDefaultMessage(string name)
        {
            return string.Format(DefaultMessage, name);
        }
    }
}
